import logging


def assertion(actual, expected, flag='eql'):
    """
    断言测试结果
    Args:
        actual: 实际结果
        expected: 预期结果
        flag: 匹配的标识，默认全匹配
    """
    if flag == 'eql':
        if actual == expected:
            logging.info("实际结果：{}，预期结果：{}，用例执行通过！".format(actual, expected))
        else:
            logging.error("实际结果：{}，预期结果：{}，用例执行失败！".format(actual, expected))
            raise AssertionError('Test case execution failed ')
    elif flag == 'in':
        if actual in expected:
            logging.info("实际结果：{}，预期结果：{}，用例执行通过！".format(actual, expected))
        else:
            logging.error("实际结果：{}，预期结果：{}，用例执行失败！".format(actual, expected))
            raise AssertionError('Test case execution failed ')
